package cn.fz.demo06.service.impl;

import cn.fz.demo06.domain.IntentionOutput;
import cn.fz.demo06.service.AiAssistant;
import cn.fz.demo06.service.AiChatService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import reactor.core.publisher.Flux;

@Service
@Slf4j
public class AiChatServiceImpl implements AiChatService {
    @Autowired
    private AiAssistant aiAssistant;

    @Override
    public Flux<String> chatStream(String userId, String message) {
        IntentionOutput intention = aiAssistant.getIntention(userId, message);
        log.info("intention:{}", intention);
        switch (intention.getIntention()) {
            case 1:
                // 丢失信息登记
                break;
            case 2:
                // 找到失物登记
                break;
            case 3:
                // 失物查询
                break;
            default:
                // 其他
                return Flux.just(intention.getOutput());
        }
        return Flux.just(intention.getOutput());
    }
}
